package cn.wx.user.controller;

import cn.wx.basic.exception.BusinessException;
import cn.wx.basic.util.JsonResult;
import cn.wx.user.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/user")
public class UserController {

        @Autowired
        private IUserService iUserService;



    @PostMapping("/phoneRegister")
    public JsonResult phoneRegister(@RequestBody Map<String,String> map){
        try {
            iUserService.phoneRegister(map);
            return JsonResult.me();
        } catch (BusinessException  e) {
            return JsonResult.me().setMsg(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            return JsonResult.me().setMsg("注册失败");
        }
    }


}
